import { createRouter, createWebHashHistory } from 'vue-router'

import Login from '@/views/Login/Login.vue'
import Main from '@/views/Layout/Main.vue'
const XtxHome = () => import('@/views/secLevel/XtxHome.vue')
const XtxCategory = () => import('@/views/secLevel/XtxCategory.vue')

// 路由设计
const routes = [
  // 首页
  {
    path: '/',
    name: 'main',
    component: Main,
    children: [
      {
        path: '',
        name: 'xtxHome',
        component: XtxHome
      },
      {
        path: '/xtxcategory/:id',
        name: 'xtxCategory',
        component: XtxCategory
      },
      {
        path: '/xtxgoods/:id',
        name: 'xtxGoods',
        component: () => import('@/views/Goods/xtxGoods.vue')
      },
      {
        path: '/cart',
        name: 'cart',
        component: () => import('@/views/Cart/Cart.vue')
      },
      {
        path: '/settlement',
        name: 'settleMent',
        component: () => import('@/views/Settlement/Settlement.vue')
      }
    ]
  },
  // 登录页
  {
    path: '/login',
    name: 'login',
    component: Login
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
